import java.util.Scanner;

public class exercise9_12 {

    private static class LinearEquation {
        private final double a, b, c, d, e, f;

        LinearEquation(double a, double b, double c,
                       double d, double e, double f) {
            this.a = a; this.b = b; this.c = c;
            this.d = d; this.e = e; this.f = f;
        }

        boolean isSolvable() { return a * d - b * c != 0; }

        double getX() { return (e * d - b * f) / (a * d - b * c); }

        double getY() { return (a * f - e * c) / (a * d - b * c); }
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.print("Enter x1, y1, x2, y2, x3, y3, x4, y4: ");
        double[] p = new double[8];
        for (int i = 0; i < 8; i++) p[i] = in.nextDouble();

        double a = p[3] - p[1];
        double b = p[0] - p[2];
        double e = a * p[0] + b * p[1];

        double c = p[7] - p[5];
        double d = p[4] - p[6];
        double f = c * p[4] + d * p[5];

        LinearEquation eq = new LinearEquation(a, b, c, d, e, f);
        if (eq.isSolvable()) {
            System.out.printf("The intersecting point is at (%.4f, %.4f)%n",
                    eq.getX(), eq.getY());
        } else {
            System.out.println("The two lines are parallel (no intersection).");
        }
    }
}